package com.ipzoe.common.bean.response;

/**
 * 错误码表.
 * <p>
 * Created on 15/11/28.
 *
 * @author xingfinal
 */
public enum Code {
    // 1024以内, 同HTTP
    SUCCESS(200, "Success."),
    UNKNOWN(2000, "未知错误"),
    IO_EXCEPTION(2001, "IO异常"),

    // 10000 ~ 49999, 留给/api使用, 并添加"API_"前缀
    API_PERMISSION_DENIED(10000, "权限不足"),

    // 50000 ~ 99999, 留给/admin使用, 并添加"ADMIN_"前缀

    ADMIN_ROLE_NOT_EXIST(50001, "角色不存在"),
    ADMIN_HAS_ADMIN_IN_ROLE(50002, "该角色下存在管理员"),
    ADMIN_ROLE_NAME_EXIST(50003, "该角色名已存在"),

    ADMIN_NOT_EXIST(51001, "管理员账户不存在"),
    ADMIN_ALREADY_EXIST(51002, "管理员账户已存在"),
    ADMIN_PASSWORD_ERROR(51003, "管理员账户密码错误"),
    ADMIN_BLOCK_SELF_ERROR(51004, "不能冻结本身账户"),
    ADMIN_BLOCK_ERROR(51005, "管理员账户已冻结"),

   ;

    private long code;
    private String message;

    Code(long code, String message) {
        this.code = code;
        this.message = message;
    }


    public long getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
